package store;

/**
 * Particulars for an item in the Store
 *
 * @author dale
 */
public class ShopItem {

    /**
     * @return the quantity
     */
    public float getQuantity() {
        return quantity;
    }

    /**
     * @param quantity the quantity to set
     */
    public void setQuantity(float quantity) {
        this.quantity = quantity;
    }
    public enum Unit {
        EACH, POUND, DOZEN
    };
    private int inventoryNumber;
    private String name;
    private float price;
    private Unit unit;
    private float quantity = 0.0f;

    /**
     * This constructor is used when adding items to a shopping cart
     *
     * @param inventoryNumber
     * @param name
     * @param price
     * @param unit
     * @param quantity
     */
    public ShopItem(int inventoryNumber, String name, float price, Unit unit, float quantity) {
        this.inventoryNumber = inventoryNumber;
        this.name = name;
        this.price = price;
        this.unit = unit;
        this.quantity = quantity;
    }

    /** This constructor is used when building the inventory list
     * 
     * @param inventoryNumber
     * @param name
     * @param price
     * @param unit
     */
    public ShopItem(int inventoryNumber, String name, float price, Unit unit) {
        this (inventoryNumber, name, price, unit, 0.0f);
    }

    @Override
    public ShopItem clone() {
        return new ShopItem(inventoryNumber, name, price, unit, quantity);
    }

    /**
     * The stock number
     *
     * @return the inventoryNumber
     */
    public int getInventoryNumber() {
        return inventoryNumber;
    }

    /**
     * Name of the item
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Price per unit
     *
     * @return the price
     */
    public float getPrice() {
        return price;
    }

    /**
     * Pound, dozen, etc.
     *
     * @return the unit
     */
    public Unit getUnit() {
        return unit;
    }

    /**
     * Subtotal for this item
     * @return subtotal
     */
    public float getSubtotal() {
        return price * quantity;
    }
}
